package com.game.gameshoppingcenter.controller;

import com.game.gameshoppingcenter.dao.GamesRepository;
import com.game.gameshoppingcenter.entities.Games;
import com.game.gameshoppingcenter.service.GamesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
@RequestMapping("/Game")
public class GamesController {
    @Autowired
    GamesRepository gamesRepository;
    @Autowired
    GamesService gamesService;

    @RequestMapping("/tobuy")
    //购买CSGO
    public String tobuy(Model model) {
        List<Games> list = gamesService.tobuy();
        System.out.println(list);
        model.addAttribute("list", list);
        return "Ordersform/ordersform";
    }
    @RequestMapping("/tobuy1")
    //购买世纪
    public String tobuy1(Model model) {
        List<Games> list1 = gamesService.tobuy1();
        System.out.println(list1);
        model.addAttribute("list1", list1);
        return "Ordersform/ordersforma";
    }
    @RequestMapping("/tobuy2")
    //购买帝国时代4
    public String tobuy2(Model model) {
        List<Games> list2 = gamesService.tobuy2();
        System.out.println(list2);
        model.addAttribute("list2", list2);
        return "Ordersform/ordersformb";
    }
    @RequestMapping("/tobuy3")
    //购买仙剑奇侠传7
    public String tobuy3(Model model) {
        List<Games> list3 = gamesService.tobuy3();
        System.out.println(list3);
        model.addAttribute("list3", list3);
        return "Ordersform/ordersformc";
    }
    @RequestMapping("/tobuy4")
   // 购买命运2
    public String tobuy4(Model model) {
        List<Games> list4 = gamesService.tobuy4();
        System.out.println(list4);
        model.addAttribute("list4", list4);
        return "Ordersform/ordersformd";
    }
    //购买战意
    @RequestMapping("/tobuy5")
    public String tobuy5(Model model) {
        List<Games> list5 = gamesService.tobuy5();
        System.out.println(list5);
        model.addAttribute("list5", list5);
        return "Ordersform/ordersforme";
    }


}
